﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SmartDesktop
{
    public partial class NewOrder : UserControl
    {        
        public NewOrder()
        {
            InitializeComponent();
            
        }


        private void chkShipBillSame_CheckedChanged(object sender, EventArgs e)
        {
            if (chkShipBillSame.Checked == true)
            {
                ddlBillingAddress.Enabled = false;
                lnkAddBillAddr.Enabled = false;
            }
            else
            {
                ddlBillingAddress.Enabled = true;
                lnkAddBillAddr.Enabled = true;
            }
        }


        protected decimal RemoveSigns(string valInfo)
        {
            if (valInfo.Contains('+'))
            {
                valInfo = valInfo.Remove(0, 1);
            }
            if (valInfo.Contains('-'))
            {
                valInfo = valInfo.Remove(0, 1);
            }
            return Convert.ToDecimal(valInfo);
        }
      
        private void chkbFrameToCome_CheckedChanged(object sender, EventArgs e)
        {
            pnFrameToCome.Visible = true;
            tblFrame.Visible = false;            
            chkbChildren.Checked = false;
            chkbMen.Checked = false;
            chkbWomen.Checked = false;;
        }

        private string ShowframeImage(int frameId)
        {
            string ImageSrc = "";
            try
            {

                string completePath = Application.StartupPath + @"\FrameImages\" + frameId + ".jpg";
                string completePathPNG = Application.StartupPath + @"\FrameImages\" + frameId + ".png";
                if (System.IO.File.Exists(completePathPNG))
                {
                    ImageSrc = completePathPNG;
                }
                else if (System.IO.File.Exists(completePath))
                {
                    ImageSrc = completePath;
                }
                else
                {
                    ImageSrc = @"FrameImages\noimage.jpg";
                }
            }
            catch
            {
                return @"FrameImages\noimage.jpg";
            }
            return ImageSrc;
        }
    }

}
